//
//  NRDesignateChoiceTableHeaderView.m
//  NetrainFrame
//
//  Created by Gin on 2020/12/9.
//

#import "NRDesignateChoiceTableHeaderView.h"

@interface NRDesignateChoiceTableHeaderView ()<UIGestureRecognizerDelegate>

@property (weak, nonatomic) IBOutlet UIButton *choiceButton;

@end

@implementation NRDesignateChoiceTableHeaderView

- (void)awakeFromNib{
    [super awakeFromNib];
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(selectGroupAction)];
    tap.delegate = self;
    [self addGestureRecognizer:tap];
}

- (void)setChecked:(BOOL)checked{
    _checked = checked;
    self.choiceButton.selected = checked;
}

- (void)selectGroupAction{
    self.choiceButton.selected = !self.choiceButton.isSelected;
    if(self.choiceBlock){
        self.choiceBlock();
    }
}

@end
